package com.yunchao.qrcode

import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.yunchao.qrcode.databinding.AdapterInvoiceInfoItemLayoutBinding

internal class InvoiceInfoAdapter : BaseQuickAdapter<InvoiceInfoModel, InvoiceInfoAdapter.VH>() {
    @SuppressLint("SetTextI18n")
    override fun onBindViewHolder(
        holder: VH,
        position: Int,
        item: InvoiceInfoModel?
    ) {
        holder.binding.text1.text = "发票号码：${item?.invoiceNumber}"
        holder.binding.text2.text = "开票金额：${item?.amount}"
        holder.binding.text3.text = "开票日期：${item?.date}"
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): VH = VH(parent)


    internal class VH(
        parent: ViewGroup,
        val binding: AdapterInvoiceInfoItemLayoutBinding = AdapterInvoiceInfoItemLayoutBinding.inflate(
            LayoutInflater.from(parent.context),
            parent,
            false
        )
    ) : RecyclerView.ViewHolder(binding.root)
}